<!DOCTYPE html>
<html>
  <head>
    <title>XMLHttpRequest: open() - case-insensitive methods test</title>
    <script src="../resources/testharness.js"></script>
    <script src="../resources/testharnessreport.js"></script>
  </head>
  <body>
    <p style="visibility: hidden;">non-standard method names should be returned as is per step-5 of https://xhr.spec.whatwg.org/#the-open()-method.</p>
    <script type="text/javascript">
      function testMethod(methodName, lastTest) {
        var client = new XMLHttpRequest();
        client.open(methodName, "resources/echo-request-method.php");
        client.onreadystatechange = function(event) {
          if (event.target.readyState == 4)
            assert_equals(client.getResponseHeader("x-custom-request-method"), methodName);
        }
        client.send(null);
      }

      test(function() { testMethod("XUNICORN"); });
      test(function() { testMethod("xUNIcorn"); });
      test(function() { testMethod("chiCKEN"); });
      test(function() { testMethod("PATCH"); });
      test(function() { testMethod("patCH"); });
      test(function() { testMethod("copy"); });
      test(function() { testMethod("COpy"); });
      test(function() { testMethod("inDEX"); });
      test(function() { testMethod("movE"); });
    </script>
  </body>
</html>

